"""
@Time ： 2021/11/11 17:39
@Auth ： ChenZhangKun
"""
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(r'D:\sofwares\chrom\chromedriver.exe')
driver.implicitly_wait(5)
driver.get('http://cdn1.python3.vip/files/selenium/test4.html')

# --- alert ---
driver.find_element(By.ID, 'b1').click()
# 打印 弹出框 提示信息
print(driver.switch_to.alert.text)
# 点击 OK 按钮
driver.switch_to.alert.accept()
